<div class="sub-contract-container">
	<select style="margin-bottom: 5px;" class="btn btn-info btn-sm select-year">
		<#assign now = .now?string('yyyy')?number> <#list 0..9 as step>
		<option value="${now-step}" ${((year==now-step)?string('selected',''))!''}>${now-step}&nbsp;年</option>
		</#list>
	</select>
	<div class="btn btn-danger btn-sm export-of-year" style="margin-top: -4px;">
		<i class="icon-signout"></i>
		导出
	</div>

	<table class="sub-contract-count" style="min-width: 1800px;">
		<tr class="title-row">
			<th class="text-center" width="45">序号</th>
			<th class="text-center">主合同编号</th>
			<th class="text-center">分包合同编号</th>
			<th class="text-center">分包合同名称</th>
			<th class="text-center">分包单位</th>
			<th class="text-center">分包金额（元）</th>
			<th class="text-center">结算金额（元）</th>
			<th class="text-center">付款金额（元）</th>
			<th class="text-center">挂账金额（元）</th>
			<th class="text-center">付款情况</th>
			<th class="text-center">剩余价款（元）</th>
			<th class="text-center">发票开具情况</th>
			<th class="text-center" width="100">主合同工期</th>
			<th class="text-center" width="100">分包合同工期</th>
			<th class="text-center">备注</th>
		</tr>
		<#if data??> <#list data as d>
		<tr>
			<td class="text-center">${d_index+1}</td>
			<td class="text-center">${d.parentNo}</td>
			<td class="text-center">${d.no}</td>
			<td class="text-center">${d.name}</td>
			<td class="text-center">${d.companyB}</td>
			<td class="text-center">${(d.price?string('#,##0.00'))!'-'}</td>
			<td class="text-center">${(d.jsPrice?string('#,##0.00'))!'-'}</td>
			<td class="text-center">${(d.payoutPrice?string('#,##0.00'))!'-'}</td>
			<td class="text-center">${(d.guazhangPrice?string('#,##0.00'))!'-'}</td>
			<td class="text-center">${d.payoutStatus}</td>
			<td class="text-center">${(d.lastPrice?string('#,##0.00'))!'-'}</td>
			<td class="text-center">${d.invoiceStatus}</td>
			<td class="text-center">${d.parentGq}</td>
			<td class="text-center">${d.htGq}</td>
			<td class="text-center">${d.remark}</td>
		</tr>
		</#list> <#else>
		<tr>
			<td colspan="15">暂无数据</td>
		</tr>
		</#if>
	</table>
</div>

<script src="${request.contextPath}/js/suredy-list.js"></script>
<script src="${request.contextPath}/core/js/jquery.form.js"></script>
<script type="text/javascript">
	$(function() {
		$('table.sub-contract-count').list({
			header : false,
			footer : false,
		});

		$('select.select-year').on('change', function() {
			var $this = $(this);

			$.suredy.loadContent('${request.contextPath}/sub-contract-count?year=' + $this.val());
		});

		$('div.btn.export-of-year').on('click', function() {
			var year = $('select.select-year').val();

			window.open('${request.contextPath}/sub-contract-count/export?year=' + year, '_blank');
		});
	});
</script>